<?php
namespace App\Console\Commands;

use Illuminate\Console\Command;
use Redis;

class RedisSubscribe extends Command
{
    /**
     * 控制台命令名称
     *
     * @var string
     */
    protected $signature = 'redis:subscribe';

    /**
     * 控制台命令描述
     *
     * @var string
     */
    protected $description = 'Subscribe to a Redis channel';

    /**
     * 执行控制台命令
     *
     * @return mixed
     */
    public function handle()
    {
        ini_set('default_socket_timeout', -1);
        $bar = $this->output->createProgressBar(1);
        $redis = new Redis();
        $redis->connect('114.215.222.20', 6445);
        $redis->auth('rxres123456');
        echo 'Jay13:' . $redis->get('Jay13');
        $bar->finish();
    }
}
